package com.annotation.lazyBean;

import com.annotation.util.model.Person;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;

@Configuration
public class LazyBeanConfig {


    @Scope//("prototype") //调整作用域
    @Lazy //懒加载
    @Bean("person")
    public Person person(){
        System.out.println("给容器中添加Pserson...");
        return new Person("张三", 5);
    }
}
